package com.siren.tank.group;

import com.siren.tank.GameModel;
import com.siren.tank.GameObject;

import java.awt.*;

/**
 * @author : wangjichao
 * @description:
 * @date : 2020/8/7 23:08
 */
public class Wall extends GameObject {

    private int beginX, beginY, endX, endY;
    private int width, height;

    public Wall(int beginX, int beginY, int endX, int endY) {
        this.beginX = beginX;
        this.beginY = beginY;
        this.endX = endX;
        this.endY = endY;
        this.width = endX - beginX;
        this.height = endY - beginY;
        GameModel.getInstance().add(this);
    }


    @Override
    public void paint(Graphics g) {
        Color c = g.getColor();
        g.setColor(Color.orange);
        g.fillRect(beginX, beginY, endX-beginX, endY-beginY);
        g.setColor(c);
    }

    public int getBeginX() {
        return beginX;
    }

    public void setBeginX(int beginX) {
        this.beginX = beginX;
    }

    public int getBeginY() {
        return beginY;
    }

    public void setBeginY(int beginY) {
        this.beginY = beginY;
    }

    public int getEndX() {
        return endX;
    }

    public void setEndX(int endX) {
        this.endX = endX;
    }

    public int getEndY() {
        return endY;
    }

    public void setEndY(int endY) {
        this.endY = endY;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}
